// Copyright 2018 The Flutter team. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:flutter/material.dart';
import 'package:english_words/english_words.dart';

void main() => runApp(MyApp());

// #docregion MyApp
class MyApp extends StatelessWidget {
  // #docregion build
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Welcome to Flutter',
      home: Scaffold(
          body: Center(
        child: Container(height: 200, child: MyList(items: new List<String>.generate(1000, (i)=> "Item $i"))),
      )),
    );
  }
// #enddocregion build
}
// #enddocregion MyApp

class MyList extends StatelessWidget {
  final List<String> items;

  MyList({Key key, @required this.items}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return ListView(
      scrollDirection: Axis.horizontal,
      children: <Widget>[
        new Container(
          width: 180,
          color: Colors.teal,
          child: new Image.network(
              'http://jspang.com/static/upload/20181111/G-wj-ZQuocWlYOHM6MT2Hbh5.jpg'),
        ),
        new Container(
            width: 180,
            color: Colors.yellow,
            child: ListView.builder(
                itemCount: items.length,
                itemBuilder: (context, index) {
                  return MyListTile(title: items[index],);
                })),
        new Container(
          width: 180,
          color: Colors.blueAccent,
        ),
      ],
    );
  }
}

class MyListTile extends StatelessWidget {

  final String title;
  MyListTile({Key key, @required this.title}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return ListTile(
      leading: new Icon(Icons.access_time),
      title: new Text(this.title),
      subtitle: new Text("子标题"),
    );
  }
}
